package com.favoritemedium.util.geolocation;

/**
 * Defines a type that describes a point on the Earth's surface
 * 
 * @author F. Azzam
 * 
 */
public class LatLong {

	private String location;
	private String country;
	private double latitude;
	private double longitude;

	public LatLong(String location, String country, String latitude,
			String latitudeDirection, String longitude,
			String longitudeDirection) {
		this.location = location;
		this.country = country;

		if ( latitudeDirection.equals("North") ) {
			this.latitude = Double.parseDouble(latitude);
		} else {
			this.latitude = Double.parseDouble(latitude) * -1;
		}

		if ( longitudeDirection.equals("East") ) {
			this.longitude = Double.parseDouble(longitude);
		} else {
			this.longitude = Double.parseDouble(longitude) * -1;
		}
	}

	public String getLocation() {
		return location;
	}

	public String getCountry() {
		return country;
	}

	public double getLatitude() {
		return latitude;
	}

	public double getLongitude() {
		return longitude;
	}

	// Only used for tests
	public String toString() {
		return (location + ", " + country + " at latitude: " + latitude
				+ " degrees, longitude: " + longitude + " degrees");
	}

}
